<template lang="pug">
    div
        h1 通告统计
        Card
            p(slot="title") 总通告量
            div(id="notice_total", style="height: 300px; width: 100%;")
        Card
            p(slot="title") 今日通告量
            div(id="notice_today", style="height: 300px; width: 100%;")
        Card
            p(slot="title") 总举报数
            div(id="notice_report", style="height: 300px; width: 100%;")
        Card
            p(slot="title") 总曝光数
            div(id="notice_exposure", style="height: 300px; width: 100%;")

</template>

<script>
    const urls = [
        'tools_statistics/getNoticeCount',
        'tools_statistics/getTodayNoticeCount',
        'tools_statistics/getReportCount',
        'tools_statistics/getExposureCount',
    ];

    export default {
        async mounted() {
            const [notice, today, report, exposure] = await Promise.all(urls.map(url => this.$http.post(url)));

            this.$showLine('notice_total',      notice.day_count,    '总通告量');
            this.$showLine('notice_today',      today.hour_count,    '今日通告量', true);
            this.$showLine('notice_report',     report.day_count,    '总举报量');
            this.$showLine('notice_exposure',   exposure.day_count,  '总曝光数');
        }
    }
</script>

<style lang="stylus" scoped>
    .ivu-card
        margin-top 40px
</style>
